\(\int \cot ^3(e+f x) (a+b \sec ^3(e+f x)) \, dx\) [456]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 21, antiderivative size = 72 \[ \int \cot ^3(e+f x) \left (a+b \sec ^3(e+f x)\right ) \, dx=-\frac {(a+b \cos (e+f x)) \csc ^2(e+f x)}{2 f}-\frac {(2 a-b) \log (1-\cos (e+f x))}{4 f}-\frac {(2 a+b) \log (1+\cos (e+f x))}{4 f} \]

[Out]

-1/2*(a+b*cos(f*x+e))*csc(f*x+e)^2/f-1/4*(2*a-b)*ln(1-cos(f*x+e))/f-1/4*(2*a+b)*ln(1+cos(f*x+e))/f

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 72, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.190, Rules used = {4223, 1828, 647, 31} \[ \int \cot ^3(e+f x) \left (a+b \sec ^3(e+f x)\right ) \, dx=-\frac {(2 a-b) \log (1-\cos (e+f x))}{4 f}-\frac {(2 a+b) \log (\cos (e+f x)+1)}{4 f}-\frac {\csc ^2(e+f x) (a+b \cos (e+f x))}{2 f} \]

[In]

Int[Cot[e + f*x]^3*(a + b*Sec[e + f*x]^3),x]

[Out]

-1/2*((a + b*Cos[e + f*x])*Csc[e + f*x]^2)/f - ((2*a - b)*Log[1 - Cos[e + f*x]])/(4*f) - ((2*a + b)*Log[1 + Co
s[e + f*x]])/(4*f)

Rule 31

Int[((a_) + (b_.)*(x_))^(-1), x_Symbol] :> Simp[Log[RemoveContent[a + b*x, x]]/b, x] /; FreeQ[{a, b}, x]

Rule 647

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> With[{q = Rt[(-a)*c, 2]}, Dist[e/2 + c*(d/(2*q)),
Int[1/(-q + c*x), x], x] + Dist[e/2 - c*(d/(2*q)), Int[1/(q + c*x), x], x]] /; FreeQ[{a, c, d, e}, x] && NiceS
qrtQ[(-a)*c]

Rule 1828

Int[(Pq_)*((a_) + (b_.)*(x_)^2)^(p_), x_Symbol] :> With[{Q = PolynomialQuotient[Pq, a + b*x^2, x], f = Coeff[P
olynomialRemainder[Pq, a + b*x^2, x], x, 0], g = Coeff[PolynomialRemainder[Pq, a + b*x^2, x], x, 1]}, Simp[(a*
g - b*f*x)*((a + b*x^2)^(p + 1)/(2*a*b*(p + 1))), x] + Dist[1/(2*a*(p + 1)), Int[(a + b*x^2)^(p + 1)*ExpandToS
um[2*a*(p + 1)*Q + f*(2*p + 3), x], x], x]] /; FreeQ[{a, b}, x] && PolyQ[Pq, x] && LtQ[p, -1]

Rule 4223

Int[((a_) + (b_.)*sec[(e_.) + (f_.)*(x_)]^(n_))^(p_.)*tan[(e_.) + (f_.)*(x_)]^(m_.), x_Symbol] :> Module[{ff =
 FreeFactors[Cos[e + f*x], x]}, Dist[-(f*ff^(m + n*p - 1))^(-1), Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*((b + a*
(ff*x)^n)^p/x^(m + n*p)), x], x, Cos[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, n}, x] && IntegerQ[(m - 1)/2] &&
IntegerQ[n] && IntegerQ[p]

Rubi steps \begin{align*} \text {integral}& = -\frac {\text {Subst}\left (\int \frac {b+a x^3}{\left (1-x^2\right )^2} \, dx,x,\cos (e+f x)\right )}{f} \\ & = -\frac {(a+b \cos (e+f x)) \csc ^2(e+f x)}{2 f}+\frac {\text {Subst}\left (\int \frac {-b+2 a x}{1-x^2} \, dx,x,\cos (e+f x)\right )}{2 f} \\ & = -\frac {(a+b \cos (e+f x)) \csc ^2(e+f x)}{2 f}+\frac {(2 a-b) \text {Subst}\left (\int \frac {1}{1-x} \, dx,x,\cos (e+f x)\right )}{4 f}+\frac {(2 a+b) \text {Subst}\left (\int \frac {1}{-1-x} \, dx,x,\cos (e+f x)\right )}{4 f} \\ & = -\frac {(a+b \cos (e+f x)) \csc ^2(e+f x)}{2 f}-\frac {(2 a-b) \log (1-\cos (e+f x))}{4 f}-\frac {(2 a+b) \log (1+\cos (e+f x))}{4 f} \\ \end{align*}

Mathematica [A] (verified)

Time = 1.18 (sec) , antiderivative size = 114, normalized size of antiderivative = 1.58 \[ \int \cot ^3(e+f x) \left (a+b \sec ^3(e+f x)\right ) \, dx=-\frac {b \csc ^2\left (\frac {1}{2} (e+f x)\right )}{8 f}-\frac {b \log \left (\cos \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}+\frac {b \log \left (\sin \left (\frac {1}{2} (e+f x)\right )\right )}{2 f}-\frac {a \left (\cot ^2(e+f x)+2 \log (\cos (e+f x))+2 \log (\tan (e+f x))\right )}{2 f}+\frac {b \sec ^2\left (\frac {1}{2} (e+f x)\right )}{8 f} \]

[In]

Integrate[Cot[e + f*x]^3*(a + b*Sec[e + f*x]^3),x]

[Out]

-1/8*(b*Csc[(e + f*x)/2]^2)/f - (b*Log[Cos[(e + f*x)/2]])/(2*f) + (b*Log[Sin[(e + f*x)/2]])/(2*f) - (a*(Cot[e
+ f*x]^2 + 2*Log[Cos[e + f*x]] + 2*Log[Tan[e + f*x]]))/(2*f) + (b*Sec[(e + f*x)/2]^2)/(8*f)

Maple [A] (verified)

Time = 1.47 (sec) , antiderivative size = 63, normalized size of antiderivative = 0.88

method result size
derivativedivides \(\frac {a \left (-\frac {\cot \left (f x +e \right )^{2}}{2}-\ln \left (\sin \left (f x +e \right )\right )\right )+b \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) \(63\)
default \(\frac {a \left (-\frac {\cot \left (f x +e \right )^{2}}{2}-\ln \left (\sin \left (f x +e \right )\right )\right )+b \left (-\frac {\csc \left (f x +e \right ) \cot \left (f x +e \right )}{2}+\frac {\ln \left (\csc \left (f x +e \right )-\cot \left (f x +e \right )\right )}{2}\right )}{f}\) \(63\)
risch \(i a x +\frac {2 i a e}{f}+\frac {b \,{\mathrm e}^{3 i \left (f x +e \right )}+2 a \,{\mathrm e}^{2 i \left (f x +e \right )}+b \,{\mathrm e}^{i \left (f x +e \right )}}{f \left ({\mathrm e}^{2 i \left (f x +e \right )}-1\right )^{2}}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) a}{f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+1\right ) b}{2 f}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) a}{f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}-1\right ) b}{2 f}\) \(139\)

[In]

int(cot(f*x+e)^3*(a+b*sec(f*x+e)^3),x,method=_RETURNVERBOSE)

[Out]

1/f*(a*(-1/2*cot(f*x+e)^2-ln(sin(f*x+e)))+b*(-1/2*csc(f*x+e)*cot(f*x+e)+1/2*ln(csc(f*x+e)-cot(f*x+e))))

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 99, normalized size of antiderivative = 1.38 \[ \int \cot ^3(e+f x) \left (a+b \sec ^3(e+f x)\right ) \, dx=\frac {2 \, b \cos \left (f x + e\right ) - {\left ({\left (2 \, a + b\right )} \cos \left (f x + e\right )^{2} - 2 \, a - b\right )} \log \left (\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) - {\left ({\left (2 \, a - b\right )} \cos \left (f x + e\right )^{2} - 2 \, a + b\right )} \log \left (-\frac {1}{2} \, \cos \left (f x + e\right ) + \frac {1}{2}\right ) + 2 \, a}{4 \, {\left (f \cos \left (f x + e\right )^{2} - f\right )}} \]

[In]

integrate(cot(f*x+e)^3*(a+b*sec(f*x+e)^3),x, algorithm="fricas")

[Out]

1/4*(2*b*cos(f*x + e) - ((2*a + b)*cos(f*x + e)^2 - 2*a - b)*log(1/2*cos(f*x + e) + 1/2) - ((2*a - b)*cos(f*x
+ e)^2 - 2*a + b)*log(-1/2*cos(f*x + e) + 1/2) + 2*a)/(f*cos(f*x + e)^2 - f)

Sympy [F]

\[ \int \cot ^3(e+f x) \left (a+b \sec ^3(e+f x)\right ) \, dx=\int \left (a + b \sec ^{3}{\left (e + f x \right )}\right ) \cot ^{3}{\left (e + f x \right )}\, dx \]

[In]

integrate(cot(f*x+e)**3*(a+b*sec(f*x+e)**3),x)

[Out]

Integral((a + b*sec(e + f*x)**3)*cot(e + f*x)**3, x)

Maxima [A] (verification not implemented)

none

Time = 0.18 (sec) , antiderivative size = 62, normalized size of antiderivative = 0.86 \[ \int \cot ^3(e+f x) \left (a+b \sec ^3(e+f x)\right ) \, dx=-\frac {{\left (2 \, a + b\right )} \log \left (\cos \left (f x + e\right ) + 1\right ) + {\left (2 \, a - b\right )} \log \left (\cos \left (f x + e\right ) - 1\right ) - \frac {2 \, {\left (b \cos \left (f x + e\right ) + a\right )}}{\cos \left (f x + e\right )^{2} - 1}}{4 \, f} \]

[In]

integrate(cot(f*x+e)^3*(a+b*sec(f*x+e)^3),x, algorithm="maxima")

[Out]

-1/4*((2*a + b)*log(cos(f*x + e) + 1) + (2*a - b)*log(cos(f*x + e) - 1) - 2*(b*cos(f*x + e) + a)/(cos(f*x + e)
^2 - 1))/f

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 172 vs. \(2 (66) = 132\).

Time = 0.30 (sec) , antiderivative size = 172, normalized size of antiderivative = 2.39 \[ \int \cot ^3(e+f x) \left (a+b \sec ^3(e+f x)\right ) \, dx=-\frac {2 \, {\left (2 \, a - b\right )} \log \left (\frac {{\left | -\cos \left (f x + e\right ) + 1 \right |}}{{\left | \cos \left (f x + e\right ) + 1 \right |}}\right ) - 8 \, a \log \left ({\left | -\frac {\cos \left (f x + e\right ) - 1}{\cos \left (f x + e\right ) + 1} + 1 \right |}\right ) - \frac {{\left (a + b + \frac {4 \, a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} - \frac {2 \, b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1}\right )} {\left (\cos \left (f x + e\right ) + 1\right )}}{\cos \left (f x + e\right ) - 1} - \frac {a {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1} + \frac {b {\left (\cos \left (f x + e\right ) - 1\right )}}{\cos \left (f x + e\right ) + 1}}{8 \, f} \]

[In]

integrate(cot(f*x+e)^3*(a+b*sec(f*x+e)^3),x, algorithm="giac")

[Out]

-1/8*(2*(2*a - b)*log(abs(-cos(f*x + e) + 1)/abs(cos(f*x + e) + 1)) - 8*a*log(abs(-(cos(f*x + e) - 1)/(cos(f*x
 + e) + 1) + 1)) - (a + b + 4*a*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) - 2*b*(cos(f*x + e) - 1)/(cos(f*x + e) +
 1))*(cos(f*x + e) + 1)/(cos(f*x + e) - 1) - a*(cos(f*x + e) - 1)/(cos(f*x + e) + 1) + b*(cos(f*x + e) - 1)/(c
os(f*x + e) + 1))/f

Mupad [B] (verification not implemented)

Time = 20.23 (sec) , antiderivative size = 86, normalized size of antiderivative = 1.19 \[ \int \cot ^3(e+f x) \left (a+b \sec ^3(e+f x)\right ) \, dx=\frac {a\,\ln \left ({\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2+1\right )}{f}-\frac {{\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (\frac {a}{8}-\frac {b}{8}\right )}{f}-\frac {{\mathrm {cot}\left (\frac {e}{2}+\frac {f\,x}{2}\right )}^2\,\left (\frac {a}{8}+\frac {b}{8}\right )}{f}-\frac {\ln \left (\mathrm {tan}\left (\frac {e}{2}+\frac {f\,x}{2}\right )\right )\,\left (a-\frac {b}{2}\right )}{f} \]

[In]

int(cot(e + f*x)^3*(a + b/cos(e + f*x)^3),x)

[Out]

(a*log(tan(e/2 + (f*x)/2)^2 + 1))/f - (tan(e/2 + (f*x)/2)^2*(a/8 - b/8))/f - (cot(e/2 + (f*x)/2)^2*(a/8 + b/8)
)/f - (log(tan(e/2 + (f*x)/2))*(a - b/2))/f